package com.wbk.lotterysystemuserservice.controller.admin;

import com.github.pagehelper.PageInfo;
import com.wbk.lotterysystemuserservice.controller.admin.biz.StoreBiz;

import com.wbk.user.qo.StoreAuditQO;
import com.wbk.user.vo.StoreVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import result.Result;


@Api
@RestController
@RequestMapping("/feign/admin/store")
public class StoreController {

    @Autowired
    StoreBiz storeBiz;

    @ApiOperation(value = "商家列表接口", notes = "商家列表")
    @GetMapping("/storeList")
    public Result<PageInfo> storeList(@ApiParam(value = "当前页") @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                      @ApiParam(value = "每页的记录数") @RequestParam(value = "pageSize", defaultValue = "5") int pageSize,
                                      @ApiParam(value = "连续显示的页数") @RequestParam(value = "navigatePages", defaultValue = "5") int navigatePages) {
        return storeBiz.storeList(pageNum, pageSize, navigatePages);
    }

    @ApiOperation(value = "待审核的商家列表接口", notes = "待审核的商家列表")
    @GetMapping("/storeListWithoutAudit")
    public Result<PageInfo> storeListWithoutAudit(@ApiParam(value = "当前页") @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                  @ApiParam(value = "每页的记录数") @RequestParam(value = "pageSize", defaultValue = "5") int pageSize,
                                                  @ApiParam(value = "连续显示的页数") @RequestParam(value = "navigatePages", defaultValue = "5") int navigatePages) {
        return storeBiz.storeListWithoutAudit(pageNum, pageSize, navigatePages);
    }

    @ApiOperation(value = "商家信息接口", notes = "商家信息")
    @GetMapping("/storeDetail/{storeUserNo}")
    public Result<StoreVO> storeDetail(@ApiParam(value = "用户编号", required = true) @PathVariable("storeUserNo") Long storeUserNo) {
        return storeBiz.storeDetail(storeUserNo);
    }

    @ApiOperation(value = "商家审核接口", notes = "商家审核")
    @PostMapping("/storeAudit")
    public Result<StoreVO> storeAudit(@RequestBody StoreAuditQO storeAuditQO) {
        return storeBiz.storeAudit(storeAuditQO);
    }
}
